<template>
  <div style="padding: 20px">
    <div class="contents">
      <el-tabs
        style="height: 100%"
        v-model="activeTab"
        type="card"
        @tab-change="handleClick"
      >
        <el-tab-pane style="height: 100%" label="执行中" name="execution">
          <div class="components-content"><execution ref="executionRef" /></div
        ></el-tab-pane>
        <el-tab-pane style="height: 100%" label="已完成" name="completed">
          <div class="components-content"><completed ref="completedRef" /></div
        ></el-tab-pane>
        <el-tab-pane style="height: 100%" label="已放弃" name="abandoned">
          <div class="components-content"><abandoned ref="abandonedRef" /></div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script lang="ts" setup>
import abandoned from '@/views/scheduleSettings/abandoned/index.vue'
import completed from '@/views/scheduleSettings/completed/index.vue'
import execution from '@/views/scheduleSettings/execution/index.vue'
import { ref } from 'vue'

const executionRef = ref<any>(null)
const completedRef = ref<any>(null)
const abandonedRef = ref<any>(null)

const activeTab = ref('execution')

const handleClick = () => {
  if (activeTab.value === 'execution') {
    executionRef.value?.changeOperator()
  } else if (activeTab.value === 'completed') {
    completedRef.value?.changeOperator()
  } else if (activeTab.value === 'abandoned') {
    abandonedRef.value?.changeOperator()
  }
}
</script>

<style lang="scss" scoped></style>
